package org.zyl.support.response;

public class BaseQueryResponse {
	/**
	 * 总数
	 */
	protected long total = 0;
	/**
	 * 总页数
	 */
	protected long pageCount = 0;
	/**
	 * 当前页数
	 */
	protected long pageNo = 1;
	/**
	 * 每页条数
	 */
	protected long pageSize = 10;
	/**
	 * 错误码
	 */
	protected int code;
	/**
	 * 错误描述
	 */
	protected String text;
	
	public BaseQueryResponse init_code(ResponseCode rc){
		this.code = rc.getCode();
		this.text = rc.getText();
		return this;
	}
	public void init_pagger(long count,int pageNo,int pageSize){
		this.total = count;
		this.pageCount = total%pageSize>0?(count/pageSize)+1:count/pageSize;
		this.pageNo = pageNo;
		this.pageSize = pageSize;
	}
	
	public void setCodeText(ResponseCode rc){
		this.code = rc.getCode();
		this.text = rc.getText();
	}

	public long getPageSize() {
		return pageSize;
	}

	public void setPageSize(long pageSize) {
		this.pageSize = pageSize;
	}

	public long getTotal() {
		return total;
	}

	public void setTotal(long total) {
		this.total = total;
	}

	public long getPageCount() {
		return pageCount;
	}

	public void setPageCount(long pageCount) {
		this.pageCount = pageCount;
	}

	public long getPageNo() {
		return pageNo;
	}

	public void setPageNo(long pageNo) {
		this.pageNo = pageNo;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

}